/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.ipccenter.toster.jpa;

import java.io.Serializable;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Set;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author 7
 */
@Entity
@Table(name = "TOSTER_USERS")
@SequenceGenerator(name="seq", sequenceName="p1_seq")
public class JPAUser implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @GeneratedValue(strategy=GenerationType.SEQUENCE,generator="seq")
    @Column(name = "USER_ID")
    private BigInteger userId;
    @Column(name = "USER_NAME")
    private String userName;
    @Column(name = "USER_SURNAME")
    private String userSurname;

    @ManyToMany
        @JoinTable(name = "USERS_SUITES", joinColumns = {
        @JoinColumn(name = "USER_ID", referencedColumnName="USER_ID")}, inverseJoinColumns = {
        @JoinColumn(name = "SUITE_ID", referencedColumnName="SUITE_ID")})
    private Set<JPATestSuite> suites;

    public Set<JPATestSuite> getSuites() {
        return suites;
    }

    public void setSuites(Set<JPATestSuite> suites) {
        this.suites = suites;
    }
    
    
    
    public JPAUser() {
    }

    public JPAUser(BigInteger userId) {
        this.userId = userId;
    }

    public BigInteger getUserId() {
        return userId;
    }

    public void setUserId(BigInteger userId) {
        this.userId = userId;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getUserSurname() {
        return userSurname;
    }

    public void setUserSurname(String userSurname) {
        this.userSurname = userSurname;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (userId != null ? userId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof JPAUser)) {
            return false;
        }
        JPAUser other = (JPAUser) object;
        if ((this.userId == null && other.userId != null) || (this.userId != null && !this.userId.equals(other.userId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "edu.ipccenter.toster.jpa.Users[ userId=" + userId + " ]";
    }
    
}
